import logging

import allure
from selenium.webdriver.support import expected_conditions as EC

from selenium.webdriver.common.by import By

from ding.LitemallPrac.page_objects.base_page import BasePage
from selenium.webdriver.support.wait import WebDriverWait

class ProductListPage(BasePage):
    _TEXT_PRODUCT_NAME = (By.XPATH, "//tbody/tr[1]/td[3]/div")
    #返回商品的名称
    logging.info("返回商品的名称")
    with allure.step("返回商品的名称"):
        def get_product_name(self):
            wait = WebDriverWait(self.driver, 10)
            element = wait.until(EC.visibility_of_element_located(self._TEXT_PRODUCT_NAME))
            return element.text

